import wx
from socket import *
import threading
from concurrent.futures import  ThreadPoolExecutor
class Server(wx.Frame):
    def __init__(self):
        # super().__init__()
        self.isOn=False
        self.server_socket=socket()
        self.server_socket.bind(('0.0.0.0',8999))
        self.server_socket.listen(5)
        wx.Frame.__init__(self, None, title= "多人聊天室", pos=(780, 250), size=(480, 520))
        self.pl=wx.Panel(self)
        self.start_server_btn=wx.Button(self.pl,pos=(10,10),size=(200,40),label="启动服务器")
        self.save_text_btn=wx.Button(self.pl,pos=(220,10),size=(200,40),label="保存聊天记录")
#       创建聊天内容文本框
        self.text_box=wx.TextCtrl(self.pl,pos=(10,60),size=(420,400),style=wx.TE_MULTILINE|wx.TE_READONLY)
#         给按钮绑定点击事件
        self.Bind(wx.EVT_BUTTON,self.start_server, self.start_server_btn)
        self.Bind(wx.EVT_BUTTON,self.save_text ,self.save_text_btn)

    def start_server(self,event):
            print("启动服务器")
    def save_text(self,event):
            print("保存聊天记录")
if __name__=="__main__":
    app=wx.App()
    server=Server()
    server.Show()
    app.MainLoop()